package expriment4_T5;

public class Employee {
    String name;
    int age;
    String sex;
    double sal;

    public Employee() {
    }

    public Employee(String name, int age, String sex, double sal) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.sal = sal;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public String getSex() {
        return sex;
    }

    public double getSal() {
        return sal;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public void setSal(double sal) {
        this.sal = sal;
    }

    public void judge() {
        System.out.printf(getName());
        if (age < 30)
            System.out.println("需要加班");
        else
            System.out.println("不需要加班");
    }
}
class EmployeeDemo{
    public static void main(String[] args) {
        System.out.println("无参函数如下：");
        Employee e1=new Employee();
        e1.setName("高园园");
        e1.setAge(18);
        e1.setSex("女");
        e1.setSal(8888.88);
        System.out.println("Employee[name="+e1.getName()+",age="+e1.getAge()+",sex="+e1.getSex()+",sal="+e1.getSal()+"]");
        e1.judge();
        System.out.println("-------------------------------------");
        System.out.println("有参函数如下：");
        Employee e2=new Employee("林青霞",35,"男",29999.99);
        System.out.println("Employee[name="+e2.getName()+",age="+e2.getAge()+",sex="+e2.getSex()+",sal="+e2.getSal()+"]");
        e2.judge();
    }
}